﻿@model BaseballGame.ViewModel.standingsViewModel

@{
    ViewBag.Title = "Game Details";
}

<h2>GameDetails</h2>
@{ @ViewBag.num   }
<fieldset>
    <legend>Pitching Stats</legend>
    <table>

         @foreach (var pitchinglabels in Model.playerPitchingStats)
        {
           <tr>
                 <td>
                  <b>Team Name</b> 
               </td>
                <td>
                   <b> Player Name</b>
                </td>
                <td>
                    @Html.DisplayNameFor(model => pitchinglabels.ip)
                </td>
                <td>
                    @Html.DisplayNameFor(model => pitchinglabels.h)
                </td>
                <td>
                    @Html.DisplayNameFor(model => pitchinglabels.r)
                </td>
               <td>
                    @Html.DisplayNameFor(model => pitchinglabels.er)
                </td>
               <td>
                    @Html.DisplayNameFor(model => pitchinglabels.bb)
                </td>
               <td>
                    @Html.DisplayNameFor(model => pitchinglabels.k)
                </td>
               <td>
                    @Html.DisplayNameFor(model => pitchinglabels.hr)
                </td>
            </tr>
            break;
         }




        @foreach (var team in Model.standings.Where(t => t.teamId == ViewBag.Homeid))
            {
                
                
                
                foreach (var player in Model.teamPlayers.Where(t => t.teamId == ViewBag.Homeid))
                {
     
                     
                    
                        foreach (var pitching in Model.playerPitchingStats.Where(t => t.PLayerId == player.Id))
                        {
                     <tr>
                     <td>
                    @if (team.team.teamName == null)
                    {
                        @ViewBag.defaulTeamName
                    }
                    else
                    {
                        @Html.DisplayFor(model => team.team.teamName)
                    }
                     </td>
                     <td>
                    @Html.DisplayFor(model => team.team.Pitcher.player_name)
                     </td>
                     
                     <td>
                   @Html.DisplayFor(model => pitching.ip) 
                         </td>
                        <td>
                           @Html.DisplayFor(model => pitching.h) 
                         </td>
                        <td>
                           @Html.DisplayFor(model => pitching.r) 
                         </td>
                        <td>
                           @Html.DisplayFor(model => pitching.er) 
                         </td>
                        <td>
                           @Html.DisplayFor(model => pitching.bb) 
                         </td>
                        <td>
                           @Html.DisplayFor(model => pitching.k) 
                         </td>
                        <td>
                           @Html.DisplayFor(model => pitching.hr) 
                         </td>
           
                   </tr>
                    break;
                }
                break;
                }
        }

 <tr> </tr><tr> </tr><tr> </tr><tr> </tr><tr> </tr><tr></tr><tr></tr>
        


         @foreach (var team in Model.standings.Where(t => t.teamId == ViewBag.Awayid))
            {
                
                
                
                foreach (var player in Model.teamPlayers.Where(t => t.teamId == ViewBag.Awayid))
                {
     
                     
                    
                        foreach (var pitching in Model.playerPitchingStats.Where(t => t.PLayerId == player.Id))
                        {
                     <tr>
                     <td>
                    @if (team.team.teamName == null)
                    {
                        @ViewBag.defaulTeamName
                    }
                    else
                    {
                        @Html.DisplayFor(model => team.team.teamName)
                    }
                     </td>
                     <td>
                    @Html.DisplayFor(model => team.team.Pitcher.player_name)
                     </td>
                     
                     <td>
                   @Html.DisplayFor(model => pitching.ip) 
                         </td>
                        <td>
                           @Html.DisplayFor(model => pitching.h) 
                         </td>
                        <td>
                           @Html.DisplayFor(model => pitching.r) 
                         </td>
                        <td>
                           @Html.DisplayFor(model => pitching.er) 
                         </td>
                        <td>
                           @Html.DisplayFor(model => pitching.bb) 
                         </td>
                        <td>
                           @Html.DisplayFor(model => pitching.k) 
                         </td>
                        <td>
                           @Html.DisplayFor(model => pitching.hr) 
                         </td>
           
                   </tr>
                    break;
                }
                break;
                }
        }
    </table>

</fieldset>


<fieldset>
    <legend>Batting Stats</legend>
    <table>
     @foreach (var hittinglabels in Model.playerHittingStats)
        {
           <tr>
               <td>
                  <b>Team Name</b> 
               </td>
                <td>
                   <b> Player Name</b>
                </td>
               <td>
                   <b> position</b>
               </td>
                <td>
                    @Html.DisplayNameFor(model => hittinglabels.atBat)
                </td>
                <td>
                    @Html.DisplayNameFor(model => hittinglabels.runs)
                </td>
                 <td>
                    @Html.DisplayNameFor(model => hittinglabels.hits)
                </td>
                <td>
                    @Html.DisplayNameFor(model => hittinglabels.rbi)
                </td>
                <td>
                    @Html.DisplayNameFor(model => hittinglabels.hr)
                </td>
                <td>
                    @Html.DisplayNameFor(model => hittinglabels.bb)
                </td> 
                <td>
                    @Html.DisplayNameFor(model => hittinglabels.k)
                </td>
                <td>
                    @Html.DisplayNameFor(model => hittinglabels.sb)
                </td>
                <td>
                    @Html.DisplayNameFor(model => hittinglabels.sb)
                </td>
            </tr>
            break;
         }


         @foreach (var team in Model.standings.Where(t => t.teamId == ViewBag.Homeid))
            {
                
                
                
                foreach (var player in Model.teamPlayers.Where(t => t.teamId == ViewBag.Homeid))
                {
     
                     
                    
                        foreach (var hitting in Model.playerHittingStats.Where(t => t.PLayerId == player.Id))
                        {
                            <tr> 
                            <td>
                                @if(team.team.teamName == null)
                                {
                                   @ViewBag.defaultTeamName
                                }
                                else
                                {
                                    @Html.DisplayFor(model => team.team.teamName)
                                }
                            </td>
                            <td>
                            @Html.DisplayFor(model => player.player_name)
                        </td>
                        <td>
                            @Html.DisplayFor(model => hitting.position)
                        </td>
                        <td>
                            @Html.DisplayFor(model => hitting.atBat)
                        </td>
                        <td>
                            @Html.DisplayFor(model => hitting.runs)
                        </td>
                        <td>
                            @Html.DisplayFor(model => hitting.hits)
                        </td>
                        <td>
                            @Html.DisplayFor(model => hitting.rbi)
                        </td>
                        <td>
                            @Html.DisplayFor(model => hitting.hr)
                        </td>
                        <td>
                            @Html.DisplayFor(model => hitting.bb)
                        </td>
                        <td>
                            @Html.DisplayFor(model => hitting.k)
                        </td>
                        <td>
                            @Html.DisplayFor(model => hitting.sb)
                        </td>
                        <td>
                            @Html.DisplayFor(model => hitting.lob)
                        </td>     
                        </tr>
                        break;
                        }
                }
             
                          
            break;
            }
          <tr> </tr><tr> </tr><tr> </tr><tr> </tr><tr> </tr><tr></tr><tr></tr>
        <tr> </tr><tr> </tr><tr> </tr><tr> </tr><tr> </tr><tr></tr><tr></tr>
        <tr> </tr><tr> </tr><tr> </tr><tr> </tr><tr> </tr><tr></tr><tr></tr>
           @foreach (var team in Model.standings.Where(t => t.teamId == ViewBag.Awayid))
            {
                
                
                
                foreach (var player in Model.teamPlayers.Where(t => t.teamId == ViewBag.Awayid))
                {
     
                     
                    
                        foreach (var hitting in Model.playerHittingStats.Where(t => t.PLayerId == player.Id))
                        {
                            <tr> 
                            <td>
                                @if(team.team.teamName == null)
                                {
                                   @ViewBag.defaultTeamName
                                }
                                else
                                {
                                    @Html.DisplayFor(model => team.team.teamName)
                                }
                            </td>
                            <td>
                            @Html.DisplayFor(model => player.player_name)
                        </td>
                        <td>
                            @Html.DisplayFor(model => hitting.position)
                        </td>
                        <td>
                            @Html.DisplayFor(model => hitting.atBat)
                        </td>
                        <td>
                            @Html.DisplayFor(model => hitting.runs)
                        </td>
                        <td>
                            @Html.DisplayFor(model => hitting.hits)
                        </td>
                        <td>
                            @Html.DisplayFor(model => hitting.rbi)
                        </td>
                        <td>
                            @Html.DisplayFor(model => hitting.hr)
                        </td>
                        <td>
                            @Html.DisplayFor(model => hitting.bb)
                        </td>
                        <td>
                            @Html.DisplayFor(model => hitting.k)
                        </td>
                        <td>
                            @Html.DisplayFor(model => hitting.sb)
                        </td>
                        <td>
                            @Html.DisplayFor(model => hitting.lob)
                        </td>     
                        </tr>
                        break;
                        }
                }
             
                          
            break;
            }
               
    </table>

</fieldset>
<p>
    @Html.ActionLink("Back to League Standings", "Index")
</p>
